<?php

import("data.db.lingvo.DbLingvo");

class Lingvo extends DbLingvo {
	
	public $static_Object		= null;
	public $sessionNameValue_PropertiesHash	= "NameValue_PropertiesHash";
	
	public function __construct($noinit=false) {
		parent::__construct($noinit);
	}
	
	function getPropertiesHash($lang_id=null) {
		if (isset($_SESSION[$this->sessionNameValue_PropertiesHash])) {
			return $_SESSION[$this->sessionNameValue_PropertiesHash];
		} else {
			$res = array();
			$list = Lingvo::findAll($lang_id);
			foreach ($list as $prop) {
				if ($prop->getClearValue()) {
					$res[$prop->getId()] = $prop->getClearValue();
				} else {
					$res[$prop->getId()] = $prop->getValue();
				}
			}
			$_SESSION[$this->sessionNameValue_PropertiesHash] = &$res;
			return $res;
		}
	}
	
	function getValue($key) {
		$table = $this->getPropertiesHash();
		return @$table[$key];
	}
	
	function getItem($key, $lang) {
		return self::findByKey($key, $lang);
	}
	
}
?>